package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class DatabaseConnection {
	Connection conn;
	Statement stmt;
	
    public Statement connect (){
    	try{
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			
			String url="jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=data.mdb";
			conn = DriverManager.getConnection(url,"","");
			stmt = conn.createStatement();
    	} catch(Exception ex){
			ex.printStackTrace();
    	}    
    	
		return stmt;
    }
    
    
	public void close(){
    	try {
			stmt.close();
		    conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
}

